String.prototype.trim = function(){
    return this.replace(/(^[\s]*)|([\s]*$)/g, "");
};

var par = /^([\d]+)$/;

function jumpPage(aObj, inputId, totlePageCnt, hrefId) {
	var pageInputObj = document.getElementById(inputId);
	var totlePageCntObj = document.getElementById(totlePageCnt);
	
	var pageInput = pageInputObj.value;
	var totlePageCntValue = totlePageCntObj.value;
	
	if((pageInput == "") || (pageInput.trim() == "")) {
		alert("请输入要跳转到的页码");
		pageInputObj.focus();
		return;
	}
	
	pageInputObj.value = pageInput.trim();
	
	if(!par.test(pageInput.trim())) {
		alert("要跳转到的页码只能为整数");
		pageInputObj.focus();
		return;
	}
	
	if(totlePageCntValue < pageInputObj.value) {
		alert("要跳转到的页码不能大于" + totlePageCntValue);
		pageInputObj.focus();
		return;
	}
	
	var hrefObj = document.getElementById(hrefId);
	window.location.href=hrefObj.value + pageInputObj.value;
}